#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
ll n, k, a[N], b[N], c[N];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	for (int i = 1; i <= n; i++) c[i] = a[i] + b[i];
	sort(c + 1, c + n + 1);
	ll sum = 0, cnt = 0;
	for (int i = 1; i <= n; i++) {
		sum += c[i];
		cnt++;
		if (sum >= k) {
			cout << cnt << '\n';
			break;
		}
	}
	return 0;
}

